package com.chen.controller;


import com.chen.entity.CartItem;
import com.chen.service.CouponHistoryService;
import com.chen.vo.Result;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 优惠券使用、领取历史表 前端控制器
 * </p>
 *
 * @author cws
 * @since 2024-11-26
 */
@RestController
@RequestMapping("/mall/couponHistory")
public class CouponHistoryController {

    @Resource
    private CouponHistoryService couponHistoryService;


    @GetMapping(value = "/couponList/{status}",produces = "application/json")
    @ApiModelProperty(value = "用户领取的优惠券列表")
    public Result UserCouponList(@PathVariable Integer status){

        return couponHistoryService.UserCouponList(status);
    }

    /**
     * 商品提交前可使用的优惠卷
     */
    @PostMapping(value = "/couponListByOrder",produces = "application/json")
    @ApiModelProperty(value = "商品提交前可使用的优惠卷")
    public Result couponListByOrder(@RequestBody List<CartItem> cartItems){
        return couponHistoryService.couponListByOrder(cartItems);
    }

}

